package com.ruoyi.web.controller.app.controller;

import com.ruoyi.framework.web.exception.base.XResult;
import com.ruoyi.web.controller.app.service.AppNearbyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * @ClassName AppNearbyController
 * @Description TODO
 * @Author tyc@yanyu
 * @Date 2018/12/13 0013 11:43
 **/
@RequestMapping("/app/nearby")
@RestController
@Api(tags = "闺蜜圈附近")
public class AppNearbyController {

    @Autowired
    private AppNearbyService nearbyService;

    @RequestMapping(value = "addNearby",method = RequestMethod.POST)
    @ApiOperation(value = "附近的人",notes = "附近的人")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "longitude", value = "经度", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "latitude", value = "纬度", required = true, dataType = "String", paramType = "query")
    })
    public XResult addNearby(@RequestParam @ApiIgnore Map<String,String> map){
        return new XResult("操作成功",nearbyService.queryUsers(map));
    }

    @RequestMapping(value = "updateNearby",method = RequestMethod.POST)
    @ApiOperation(value = "修改经纬度",notes = "修改经纬度")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "longitude", value = "经度", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "latitude", value = "纬度", required = true, dataType = "String", paramType = "query")
    })
    public XResult updateNearby(String longitude, String latitude, String memberId){
        return new XResult("操作成功",nearbyService.updateNearby(longitude,latitude,memberId));
    }
}
